export default {
    namespaced: true,
    state: {
        // 控制模态框显示隐藏
        isShowToast: false,
        // toast的内容
        toastMsg: "",
        // toast的类型(success, danger, warnning)
        toastType: ""

    },
    getters: {

    },
    mutations: {
        // 修改控制模态框开关
        changeIsShowToast(state, payload) {
            state.isShowToast = payload.isShow
            if (payload.isShow) {
                state.toastMsg = payload.title,
                    state.toastType = payload.type
            }

        }
    },
    actions: {
        asyncShowToast(context, payload) {
            context.commit("changeIsShowToast", payload)
            setTimeout(() => {
                context.commit("changeIsShowToast", {
                    isShow: false
                })
            }, 2000);
        }
    }
}